package com.qingcloud.task.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @author zhengjibin
 * @version 1.0.0
 * @ClassName PageVO.java
 * @Description
 * @createTime 2021年08月06日 10:15:00
 */
@Data
public class PageVO<T> {
    @ApiModelProperty("数据列表")
    private List<T> list;

    @ApiModelProperty(value = "总条数",example = "0")
    private long total;//总条数

    @ApiModelProperty(value = "总页数",example = "0")
    private long pages;//总页数

    @ApiModelProperty(value = "当前页",example = "0")
    private long current;

    public static <T> PageVO<T> getPage(Page page){
        return new PageVO(page.getRecords(),page.getTotal(),page.getPages(),page.getCurrent());
    }

    public PageVO(List list, long total, long pages, long current) {
        this.list = list;
        this.total = total;
        this.pages = pages;
        this.current = current;
    }

    public PageVO() {
    }
    public void setList(List<T> list){
        this.list = list;
    }
}
